{extend name="public:base" /}
{block name="content"}

<div class="page-header">
	<h1>	
		{$breadcrumb1}
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			{$breadcrumb2}
		</small>
	</h1>
</div>
<div class="page-header">
	<a href="{:url('GroupBuy/add')}" class="btn btn-primary">新增</a>
</div>	
	
<div class="row">
	<div class="col-xs-12">	
		<div class="table-responsive">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>			
						<th>图片</th>							
						<th>团购名称</th>
						<th>点击量</th>
						<th>原价（元）</th> 
						<th>团购价（元）</th>  
						<th>数量</th>
						<th>每人限购</th>  
						<th>关联商品</th>
						<th>开始时间</th> 
						<th>结束时间</th> 
						<th>状态</th>
						<th>操作</th>				
					</tr>
				</thead>
				<tbody>
						{volist name="list" id="v" empty="$empty"}
						<tr>							
							<td>
								{if condition="$v['group_image']"}
		                  			<img src="IMG_ROOT{$v.group_image|resize=50,50}" />
			                  	{else /}
			                  		<img src="__PUBLIC__/image/no_image_50x50.jpg" />
			                  	{/if}
							</td>
							<td>{$v.group_name}</td>
							<td>{$v.views}</td>
							<td>{$v.goods_price}</td>
							<td>{$v.group_price}</td>
							<td>{$v.quantity}</td>
							<td>
								{if condition="$v['buy_limit'] eq 0"}
								不限
								{else/}
								{$v.buy_limit}
								{/if}
							</td>
							<td>
								{if condition="$v['goods_id'] eq 0"}
									<span class="red">否</span>
								{else/}
									<span class="green">是</span>
								{/if}
							</td>
							<td>
								{$v.start_time|date="Y-m-d",###}
							</td>
							<td>
								{$v.end_time|date="Y-m-d",###}
							</td>
							<td>								
								{switch name="v.status"}
									{case value="1"}<a href='{:url("GroupBuy/set_status",array("id"=>$v["id"],"status"=>0))}'><span title="启用" class="btn btn-xs btn-success"><i class="fa fa-check bigger-120"></i></span></a>{/case}
									{case value="0"}<a href='{:url("GroupBuy/set_status",array("id"=>$v["id"],"status"=>1))}'><span title="禁用" class="btn btn-xs btn-danger"><i class="fa fa-remove bigger-120"></i></span></a>{/case}
								{/switch}
							</td>
							<td>
								<a class="btn btn-xs btn-info" href='{:url("GroupBuy/edit",array("id"=>$v["id"]))}'>
									<i class="fa fa-edit bigger-120"></i>
								</a> 
								<a class="delete btn btn-xs btn-danger" href='{:url("GroupBuy/del",array("id"=>$v["id"]))}'>
									<i class="fa fa-trash bigger-120"></i>
								</a>
							</td>
						</tr>
						{/volist}	
						
						<tr>
							<td colspan="20" class="page">{$list->render()}</td>
						</tr>
				</tbody>
				
			</table>
		</div>
	</div>
</div>
{/block}